home *** CD-ROM | disk | FTP | other *** search
- // dlgitem.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "itgdemo.h"
- #include "dlgitem.h"
- #include "itgdefs.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CDlgItem dialog
-
-
- CDlgItem::CDlgItem(CVBControl *pITGraph, CWnd* pParent /*=NULL*/)
- : CDialog(CDlgItem::IDD, pParent)
- {
- m_ITGraph = pITGraph;
- int selIx = (int)m_ITGraph->GetNumProperty("SelectedIndex");
-
- //{{AFX_DATA_INIT(CDlgItem)
- m_ItemId = m_ITGraph->GetNumProperty("ItemId", selIx);
- m_ItemData = m_ITGraph->GetNumProperty("ItemData", selIx);
- m_ItemHeight = (int)m_ITGraph->GetNumProperty("ItemHeight", selIx);
- m_ItemWidth = (int)m_ITGraph->GetNumProperty("ItemWidth", selIx);
- m_ItemXpos = (int)m_ITGraph->GetNumProperty("ItemXpos", selIx);
- m_ItemYpos = (int)m_ITGraph->GetNumProperty("ItemYpos", selIx);
- m_ItemList = m_ITGraph->GetStrProperty("List", selIx);
- //}}AFX_DATA_INIT
- }
-
- void CDlgItem::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgItem)
- DDX_Text(pDX, IDC_EDTITEMID, m_ItemId);
- DDX_Text(pDX, IDC_EDTITEMDATA, m_ItemData);
- DDX_Text(pDX, IDC_EDTITEMHEIGHT, m_ItemHeight);
- DDV_MinMaxInt(pDX, m_ItemHeight, 0, 32767);
- DDX_Text(pDX, IDC_EDTITEMWIDTH, m_ItemWidth);
- DDV_MinMaxInt(pDX, m_ItemWidth, 0, 32767);
- DDX_Text(pDX, IDC_EDTITEMXPOS, m_ItemXpos);
- DDX_Text(pDX, IDC_EDTITEMYPOS, m_ItemYpos);
- DDX_Text(pDX, IDC_EDTITEMLIST, m_ItemList);
- DDV_MaxChars(pDX, m_ItemList, 255);
- //}}AFX_DATA_MAP
-
- if(!pDX->m_bSaveAndValidate) {
- int selIx = (int)m_ITGraph->GetNumProperty("SelectedIndex");
- char tmpStr[16];
-
- m_ITGraph->SetNumProperty("QueryItem", selIx);
- m_ITGraph->SetNumProperty("QueryState", ITG_QueryGetSources);
- sprintf(tmpStr, "Sources: %d", (int)m_ITGraph->GetNumProperty("QueryCount"));
- SendDlgItemMessage(IDC_LBLSOURCES, WM_SETTEXT, 0, (LPARAM)tmpStr);
- SendDlgItemMessage(IDC_LISTSOURCES, LB_RESETCONTENT, 0, 0);
- while(m_ITGraph->GetNumProperty("QueryState") != ITG_QueryNone) {
- int srcIndex = (int)m_ITGraph->GetNumProperty("ConnectFromIndex");
- SendDlgItemMessage(IDC_LISTSOURCES, LB_ADDSTRING, 0, (LPARAM)(const char *)m_ITGraph->GetStrProperty("List", srcIndex));
- m_ITGraph->SetNumProperty("QueryState", ITG_QueryIterate);
- }
-
- m_ITGraph->SetNumProperty("QueryItem", selIx);
- m_ITGraph->SetNumProperty("QueryState", ITG_QueryGetTargets);
- sprintf(tmpStr, "Targets: %d", (int)m_ITGraph->GetNumProperty("QueryCount"));
- SendDlgItemMessage(IDC_LBLTARGETS, WM_SETTEXT, 0, (LPARAM)tmpStr);
- SendDlgItemMessage(IDC_LISTTARGETS, LB_RESETCONTENT, 0, 0);
- while(m_ITGraph->GetNumProperty("QueryState") != ITG_QueryNone) {
- int tgtIndex = (int)m_ITGraph->GetNumProperty("ConnectToIndex");
- SendDlgItemMessage(IDC_LISTTARGETS, LB_ADDSTRING, 0, (LPARAM)(const char *)m_ITGraph->GetStrProperty("List", tgtIndex));
- m_ITGraph->SetNumProperty("QueryState", ITG_QueryIterate);
- }
- }
- }
-
- BEGIN_MESSAGE_MAP(CDlgItem, CDialog)
- //{{AFX_MSG_MAP(CDlgItem)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CDlgItem message handlers
-
- void CDlgItem::OnOK()
- {
- if(UpdateData(TRUE)) {
- int selIx = (int)m_ITGraph->GetNumProperty("SelectedIndex");
- m_ITGraph->SetStrProperty("List", m_ItemList, selIx);
- m_ITGraph->SetNumProperty("ItemData", m_ItemData, selIx);
- m_ITGraph->SetNumProperty("ItemXpos", m_ItemXpos, selIx);
- m_ITGraph->SetNumProperty("ItemYpos", m_ItemYpos, selIx);
- m_ITGraph->SetNumProperty("ItemWidth", m_ItemWidth, selIx);
- m_ITGraph->SetNumProperty("ItemHeight", m_ItemHeight, selIx);
-
- CDialog::OnOK();
- }
- }
-